<script setup lang="ts">
import MessageItem from '@/components/MessageItem.vue';
import { onMounted, ref } from 'vue';
import { getMessageListApi } from '@/api/message';
const visible = ref(false);
const open = () => {
  visible.value = !visible.value;
};
const messageList = ref([]);

const getList = async () => {
  const { data } = await getMessageListApi();
  console.log(data);
  messageList.value = messageList.value.concat(data);
};
onMounted(() => {
  getList();
});
</script>

<template>
  <div class="container">
    <div class="content-container">
      <t-row :gutter="16" style='width: 100%'>
        <t-col :span="3" v-for="(item,index) in messageList" :key="index">
          <message-item type="blue"  ></message-item>
        </t-col>
      </t-row>
    </div>
    <div class="add-btn" @click="open"><t-icon name="add" size="30px" /></div>
  </div>
  <t-drawer v-model:visible="visible" :show-overlay="false"> </t-drawer>
</template>

<style scoped>
.container {
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  padding-top: 50px;
}

.content-container {
  width: 1400px;
  //margin: 40px auto 20px auto;
}

.add-btn {
  width: 70px;
  height: 70px;
  background-color: var(--hj-font-color);
  position: fixed;
  bottom: 50px;
  right: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.2);
  color: var(--hj-inverse-font-color);
  transition: transform 1s;
  &:hover {
    transform: rotate(90deg);
  }
}
</style>
